import Vue from 'vue'
import App from './App.vue'

// 注册为全局组件
import TypeNav from './components/TypeNav/TypeNav.vue'
Vue.component(TypeNav.name, TypeNav)// (全局组件的名称，组件)
import Carousel from './components/Carousel/Carousel.vue'
Vue.component(Carousel.name, Carousel)// (全局组件的名称，组件)
import Pagination from './components/Pagination/Pagination.vue'
Vue.component(Pagination.name, Pagination)// (全局组件的名称，组件)

import {  MessageBox } from 'element-ui';
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

Vue.config.productionTip = false

import router from '@/router'
// 引入仓库
import store from "@/store"

// 引入mockServe.js文件
import '@/mock/mockServe'

import 'swiper/swiper-bundle.css'

// 同意接受api文件夹里面的全部发送请求函数
import * as API from '@/api'


// import VueLazyload from 'vue-lazyload'
// // import loadimage from '@/assets/loading.gif'
// const loadimage = require('@/assets/loading.gif')
// Vue.use(VueLazyload, {
//   loading: loadimage
// })

// 引入自定义插件
import myPlugins from '@/plugins/myPlugins'
Vue.use(myPlugins, {name: 'upper'})


// 引入表单校验插件
import "@/plugins/validate"

new Vue({
  render: h => h(App),
  router,
  // 注册仓库：组件实例的身上会多一个属性叫$store
  store,
  beforeCreate() {
    Vue.prototype.$bus = this
    Vue.prototype.$API = API
  },
}).$mount('#app')
